package com.ce.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.ce.entity.Customer;
import com.ce.entity.ShoppingList;
import com.ce.mapper.ShoppingListMapper;
import com.ce.service.ShoppingListService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jyt
 * @since 2022-03-07
 */
@Service
public class ShoppingListServiceImpl extends ServiceImpl<ShoppingListMapper, ShoppingList> implements ShoppingListService {
    /**
     * 获取采购清单列表
     */
    @Resource
    private ShoppingListMapper mapper;

    @Override
    public List<ShoppingList> getList(ShoppingList shoppingList) {
        return mapper.selectList(shoppingList);
    }

    @Override
    public List<ShoppingList> getListForPrice() {
        return mapper.selectShopListPrice();
    }

    @Override
    public List<ShoppingList> getListForPrice(ShoppingList shoppingList) {
        return mapper.selectShoppingListPrice(shoppingList);
    }

    /**
     * 添加采购清单列表
     */
    @Override
    public Map<String, String> addShoppingList(ShoppingList shoppingList) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("mode", "insert one ShoppingList");
        mapper.insert(shoppingList);
        return map;
    }

}
